<template>
  <div class="view-box-lj" ref="viewBox">
    <div class="seckill-component" id="seckill-component">
      <div class="app-content-box">
        <div class="content-box">
          <div class="yhq-title">{{seckilData.activityName|appData('activityName')}}</div>
          <div class="yhq-content">
            <div class="text-content">
              {{seckilData.activityContent|appData('activityContent')}}
            </div>
            <div class="yhq-box">
              <div class="yhq-img" v-for="(item,index) in goodsList" :key="index">
                <div class="left-box">
                  <div>
                    <span>￥</span>
                    <span class="cost">{{item.preferentialMoney}}</span>
                  </div>
                  <div class="condition">满{{item.conditionMoney}}可用</div>
                </div>
                <div class="center-box">
                  <div class="name">{{item.couponName||'优惠券'}}</div>
                  <div class="store">门店通用</div>
                </div>
                <div class="right-box">
                  <button>立即领取</button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>


let defaultData = {
  activityName: "超值立减金限时大放送",
  activityContent: "活动内容文案活动内容文案活动内容文案活动内容文案活动内容文案活动内容文案活动内容文案活动内容文案活动内容文案活动内容文案活动内容文案活动内容"
}
export default {
  name: 'SeckillMobile',
  props: {
    seckilData: {
      activityName: {
        type: String,
        default() {
          return '0'
        },
      },
      activityContent: {
        type: String,
        default() {
          return '0'
        },
      },
      activityUnit: {
        type: Array,
        default() {
          return [{
            applicableUnit: "西安市高新科技园店",
            unitAddress: "西安市雁塔区GOGO街区"
          }]
        }
      }
    },
    goodsList: {
      type: Array,
      default() {
        return []
      },
    },
  },
  filters: {
    appData(val, key) {
      if (val && val != '') {
        return val
      } else {
        return defaultData[key]
      }
    }
  },

  data() {
    return {

    }
  },
  mounted() {
    // js

    this.zoom()
    // 窗口大小变化时，需要重算
    window.addEventListener('resize', this.zoom, false)
  },
  methods:{
    zoom(){
      let domBody = document.getElementsByClassName('view-box-lj')[0]
      domBody.style.zoom = document.body.clientWidth / 22 + '%'
    }
  },
  destroyed() {
    window.removeEventListener('resize', this.zoom, false)
  },
}
</script>

<style scoped>
.seckill-component {
  background: blue;
  width: 374px;
  height: 735px;
  font-size: 12px;
  margin: 0 auto;

}

.yhq-title {
  height: 116px;
  width: 265px;
  margin: 60px auto;
  font-size: 52px;
  line-height: 60px;
  font-style: italic;
  font-weight: 600;
  color: #FFFFFF;
  text-shadow: 6px 3px red;
  text-align: center;
}

.yhq-content {
  width: 330px;
  margin: 290px auto 0;
  background-color: #df282e;
  border-radius: 19px;
}

.yhq-content .text-content {
  padding: 20px 30px 5px 30px;
  color: #ffffff;
  font-size: 13px;
  line-height: 24px;
}

.yhq-box {
  background-color: #fd4a50;
  min-height: 100px;
  border-radius: 9.5px;
  padding: 10px 10px 1px  10px;
}

.yhq-img {
  background-image: url(./img/yhqbg.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  height: 95px;
  display: flex;
  margin-bottom: 10px;
}

.left-box {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-flow: column;
  color: #ca151b;
}

.left-box .cost {
  font-size: 21px;
  font-weight: 900;
  text-align: center;
  font-style: oblique;
}

.left-box .condition {
  font-size: 10.5px;
  font-weight: bold;
  text-align: center;
}

.center-box {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-flow: column;
}

.center-box .name {
  font-size: 13px;
  font-weight: bold;
  text-align: left;
}

.center-box .store {
  font-size: 13px;
  font-weight: bold;
  text-align: left;
}

.right-box {
  flex: 1;
  line-height: 95px;
  text-align: center;
}

.right-box button {
  border-radius: 14px;
  color: #ffffff;
  font-size: 12px;
  background: linear-gradient(#eb222a 0%, #ff5266 100%);
  border: none;
  height: 28px;
  width: 90px;
}

.view-box-lj {
  background: #ffffff;
  width: 432px;
  height: 865px;
  font-size: 12px;
  margin: 0 auto;
  background-image: url(../commImg/phone/left.png), url(../commImg/phone/top.png), url(../commImg/phone/right.png), url(../commImg/phone/lower.png);
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  background-position: left bottom, top, right bottom, bottom;
  padding: 65px 30px 59px 29px;
}

::-webkit-scrollbar {
  width: 0 !important;
}

::-webkit-scrollbar {
  width: 0 !important;
  height: 0;
}


.app-content-box {
  height: 100%;
  width: 100%;
  overflow: auto;
}

.content-box {
  width: 100%;
  background-image: url(./img/yhqbg1.png);
  background-repeat: no-repeat;
  background-size: 100% 700px;
  padding-bottom: 40px;
}


.app-header-banner .app-header-card .app-header-card-price div {
  position: relative;
  display: inline-block;
  height: 20px;
}


p {
  margin: 0;
}


.content >>> img {
  width: 340px !important;
  margin: 0 auto;
}

.app-footer {
  background: #fc3f46;
  height: 40px;
  border-radius: 0 0 60px 60px;
}

</style>
